#include <iostream>
using namespace std;

template<typename T>
void bubbleSort(T arr[], const int size) {
    for (int i = 0; i < size - 1; ++i) {
        for (int j = 0; j < size - 1 - i; ++j) {
            if (arr[j] > arr[j + 1]) {
                T temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
}

int main() {
    const int SIZE = 5;
    int arr1[SIZE] = { 3, 7, 2, 9, 4 };
    double arr2[SIZE] = { 6.8, 2.1, 13.7, 7.4, 5.0 };

    std::cout << "Before bubble sort:" << std::endl;
    for (int i = 0; i < SIZE; ++i) {
        std::cout << arr1[i] << " ";
    }
    std::cout << std::endl;

    bubbleSort(arr1, SIZE);

    std::cout << "After bubble sort:" << std::endl;
    for (int i = 0; i < SIZE; ++i) {
        std::cout << arr1[i] << " ";
    }
    std::cout << std::endl;

    std::cout << "Before bubble sort:" << std::endl;
    for (int i = 0; i < SIZE; ++i) {
        std::cout << arr2[i] << " ";
    }
    std::cout << std::endl;

    bubbleSort(arr2, SIZE);

    std::cout << "After bubble sort:" << std::endl;
    for (int i = 0; i < SIZE; ++i) {
        std::cout << arr2[i] << " ";
    }
    std::cout << std::endl;

    return 0;
}